#ifndef PROTOCOL_HPP
#define PROTOCOL_HPP


extern bool ground_cmd_flag;


uint8_t set_checksum(uint8_t* buffer, uint8_t index);
void analyse_flight_control(circleBuf_t* temp, uint8_t* data);
void analyse_groundbase(circleBuf_t* temp, uint8_t* data);

uint8_t NX_serial_send_to_groundbase_10hz(LinuxSerialDevice* radio, drone_data_to_groundbase_t* para);
uint8_t NX_serial_send_to_groundbase_20hz(LinuxSerialDevice* radio, drone_data_to_groundbase_t* para);
uint8_t NX_serial_send_to_flight_control(LinuxSerialDevice* radio, groundbase_cmd_t* para);
uint8_t NX_serial_send_to_flight_control_query(LinuxSerialDevice* radio, groundbase_cmd_t* para);
void analyse_SBUS(circleBuf_t* temp, uint8_t* data) ;



uint8_t NX_get_flight_control_cmd_ACK(uint8_t* data,uint8_t len);
uint8_t Query_to_flight_control_back_flightpoint(uint8_t* data,uint8_t len);
uint8_t NX_serial_send_to_groundbase_of_waypoint_ACK(LinuxSerialDevice* radio);   //给地面站的ACK
uint8_t NX_send_waypoint_to_flight_control(LinuxSerialDevice* radio);
uint8_t NX_get_flight_control_query1_back(uint8_t* data,uint8_t len) ;
uint8_t NX_get_flight_control_query2_back(uint8_t* data,uint8_t len) ;
uint8_t NX_get_flight_control_query3_back(uint8_t* data,uint8_t len) ;
uint8_t NX_get_flight_control_query4_back(uint8_t* data,uint8_t len) ;
uint8_t NX_get_flight_control_query7_back(uint8_t* data,uint8_t len) ;
uint8_t NX_get_flight_control_query8_back(uint8_t* data,uint8_t len) ;
uint8_t SBUS_data_transform_to_remote_channels_value(uint8_t* data,uint8_t len);




#endif